﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Common.DBFHelper
{
    /// <summary>
    /// 股份结算信息库记录，见《深圳证券交易所数据接口规范v4.57》第42页
    /// </summary>
    public class SJSGFRecord : DBFRecordBase<SJSGFRecord>
    {
        /// <summary>
        /// 构造函数
        /// </summary>
        private SJSGFRecord() { }

        /// <summary>
        /// 从字节数组中读取DBF记录
        /// </summary>
        /// <param name="buffer">字节数组</param>
        /// <param name="offset">偏移</param>
        /// <returns></returns>
        public override DBFRecordBase ReadRecordFromBuffer(byte[] buffer, int offset, Dictionary<string, DbfColumn> columnDic)
        {
            return new SJSGFRecord()
            {
                StkId = ReadStringField(buffer, offset, columnDic["GFZQDM"].Offset, columnDic["GFZQDM"].Size),
                YWLB = ReadStringField(buffer, offset, columnDic["GFYWLB"].Offset, columnDic["GFYWLB"].Size),
                ZZJE = ReadDoubleField(buffer, offset, columnDic["GFZJJE"].Offset, columnDic["GFZJJE"].Size),
            };
        }


        #region 属性
        /// <summary>
        /// 证券代码
        /// </summary>
        [DBFRecordField(7, 6, "GFZQDM")]
        public string StkId { get; private set; }

        /// <summary>
        /// 业务类别
        /// </summary>
        [DBFRecordField(23, 2, "GFYWLB")]
        public string YWLB { get; private set; }

        /// <summary>
        /// 资金金额
        /// </summary>
        [DBFRecordField(87, 15, "GFZJJE")]
        public double ZZJE { get; private set; }
        #endregion
     
    }
}
